; If the printer hasn't been homed, home it
if {global.idex} = 0
	if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
		G28				; home all
elif {global.idex} = 1
	if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed || !move.axes[3].homed
		G28				; home all

T1 P0				; select secondary hotend
G1 Z30 				; move to Z=30
G1 X100 Y200 F3000	; move to X100, Y150
G4 P0 				; wait for all movements to complete
M300 S1111 P333		; beep

M291 S2 R"Secondary blower fan testing" P"The part cooling fan will spin for 10 seconds. Verify that it works"
M106 P1 S255		; turn part cooling fan at 100%
G4 S10				; wait 10 seconds
M106 P1 S0			; turn part cooling off
G4 P0				; wait
M300 S1111 P333		; beep
M291 S2 R"Secondary blower fan testing" P"Did the part cooling turn on and off as it should?"

M291 S2 R"Heater testing" P"In the next step, the hotend will heat up to 210c."
if {global.generation} = 5
	M291 S2 R"Heater testing" P"Check that the heatsink fan turns on when the temperature rises above 45c"
elif {global.generation} = 4
	M291 S2 R"Heater testing" P"Check that the heatsink fan turns on when the temperature rises above 45c"

M570 H1 P50 T50		; Extend the heater H1 fault timeout to 50 seconds for testing
M568 P1 S210 R0		; set temperature to 210c
T1					; select secondary hotend
M116 P1				; wait for P1 to reach target temp
M570 H1 P5 T15		; return the the heater H1 fault settings to default
M300 S1111 P333		; beep
M291 S2 R"Heater testing" P"Did the hotend heat up to 210c as it should?"

M291 S2 R"Extruder testing" P"The extruder will now extrude filament for 10 seconds"
M83					; relative extruder moves
G1 E30 F180 		; extrude 30mm of filament over 10 seconds
G4 P0				; wait for the moves to finish   
M300 S1111 P333		; beep
M568 P1 S0 R0		; set temperature to 0c
T-1					; deselect secondary hotend
M300 S1111 P333		; beep
M291 S2 R"Extruder testing" P"Did the extruder correctly extrude filament? If not, check the guide for troubleshooting"

M291 S3 R"You may proceed to the next step" P"Secondary hotend verification has been completed" ;
M568 P1 S0 R0 A0
M18					; release stepper motors